<html>
	{% include "../common_head.html" %}
	<body>
	{% include "../common_menus.html" %}
	<div id="content">
	
	<div id="rakontu_form_style" class="rakontu_form">
	<form action="/{{dir_admin}}/{{url_admin}}" method="post" enctype="multipart/form-data">
	
	<h2>{{template_site_initialization_tasks}} {{"site_initialization_tasks"|tip}} 
	{{"site_initialization_tasks"|caution}}</h2>
	
	<fieldset>
	<ol>
	<li><a href="/{{dir_admin}}/{{url_default_resources}}">{{template_generate}}</a> 
	{{template_default_help_resources_from}} <code>{{DEFAULT_RESOURCES_FILE_NAME}}</code> -
	<b>{{num_default_resources}}</b> {{template_have_been_created}} 
	{% if site_resource_names %} ({{site_resource_names}}) {% endif %}
	</li>
	<li><a href="/{{dir_admin}}/{{url_skins}}">{{template_generate}}</a> 
	{{template_skins_from}} <code>{{SKINS_FILE_NAME}}</code> -
	<b>{{num_skins}}</b> {{template_have_been_created}} 
	{% if skin_names %} ({{skin_names}}) {% endif %}
	</li>
	<li><a href="/{{dir_admin}}/{{url_helps}}">{{template_generate}}</a> 
	{{template_help_texts_from}} <code>{{HELP_FILE_NAME}}</code> -
	<b>{{num_helps}}</b> {{template_have_been_created}} 
	</li>
	<li><a href="/{{dir_admin}}/{{url_sample_questions}}">{{template_generate}}</a> 
	{{template_sample_questions_from}} <code>{{SAMPLE_QUESTIONS_FILE_NAME}}</code> -
	<b>{{num_sample_questions}}</b> {{template_have_been_created}} 
	</li>
	</ol>
	</fieldset>
	
	<h2>Rakontus</h2>
	{% if rakontus %}
		
    	{% for rakontu in rakontus %}
		<fieldset>
	    		<h3>{{rakontu.linkString}} ({{rakontu.getKeyName}})</h3> 
	    		<p> {{template_created}}: {{rakontu.created|timeZone:"UTC"|date:"F j, Y"}}.
	    		{{template_last_activity}}: {{rakontu.getDateOfLastActivity|timeZone:"UTC"|date:"F j, Y"}}.
	    		</p>
	    		<p>{{rakontu.numActiveMembers}} {{template_active_members}},
					{{rakontu.numPendingMembers}} {{template_pending_members}},
					{{rakontu.numEntries}} {{template_entries}}.</p>
				
				<p>
				{{template_membership}}:
	    		{% if member_of|dictLookup:rakontu.key %}
		    			<select name="switch|{{rakontu.key}}">
		    			<option value="member"
		    			{% if member_of|dictLookup:rakontu.key|equalTest:"member" %}
		    				selected="selected"
		    			{% endif %}
		    			>{{governance_roles_display|listLookup:0}}</option>
		    			<option value="manager"
		    			{% if member_of|dictLookup:rakontu.key|equalTest:"manager" %}
		    				selected="selected"
		    			{% endif %}
		    			>{{governance_roles_display|listLookup:1}}</option>
		    			<option value="owner"
		    			{% if member_of|dictLookup:rakontu.key|equalTest:"owner" %}
		    				selected="selected"
		    			{% endif %}
		    			>{{governance_roles_display|listLookup:2}}</option>
		    			</select>
		    			<input type="submit" name="switchTo|{{rakontu.key}}" value="{{button_switch}}" class="button_small">
	    		{% else %}
	    			{% if pending_member_of|dictLookup:rakontu.key %}
	    				({{template_pending_member|lower}})
	    			{% endif %}
	    			
	    		{% endif %}
	    		{% if member_of|dictLookup:rakontu.key %}
	    			{% if only_owner_of|dictLookup:rakontu.key %}
	    				<i>{{template_cannot_leave_only_owner}}</i>
	    			{% else %}
	    				<input type="submit" name="joinOrLeave|{{rakontu.key}}" value="{{button_leave}}" class="button_small">
	    			{% endif %}
	    		{% else %}
	    			{% if pending_member_of|dictLookup:rakontu.key %}
	    				({{template_click_rakontu_name_to_join}})
	    			{% else %}
		    			{{template_join_as_a}}
		    			<select name="joinAs|{{rakontu.key}}">
		    			<option value="member">{{governance_roles_display|listLookup:0}}</option>
		    			<option value="manager">{{governance_roles_display|listLookup:1}}</option>
		    			<option value="owner">{{governance_roles_display|listLookup:2}}</option>
		    			</select>
		    			<input type="submit" name="joinOrLeave|{{rakontu.key}}" value="{{button_join}}" class="button_small">
		    		{% endif %}
	    		{% endif %}
	    		</p>
	    		
	    		<p>
	    		{{template_rakontu_access_state}}
				<select name="access|{{rakontu.key}}" style="background:#{{rakontu.accessColorString}}">
					{% for i in rakontu_access_states|makeRangeFromListLength %}
						<option value="{{rakontu_access_states|listLookup:i}}"
						{% if rakontu_access_states|listLookup:i|equalTest:rakontu.access %}
							selected="selected"
						{% endif %}
						>{{rakontu_access_states_display|listLookup:i}}</option>
					{% endfor %}
				</select>
				&nbsp {{template_access_message}}: {{"access_messages"|tip}}
				<input type="text" size="30" name="accessMessage|{{rakontu.key}}" value="{{rakontu.accessMessage|orNothing}}" maxlength="{{maxlength_subject_or_comment}}">
  				<input type="submit" name="changeAccess|{{rakontu.key}}" value="{{button_change}}" class="button_small">
  				</p>
			<div class="rightalign">
			<a href="/{{dir_admin}}/{{url_confirm_remove_rakontu}}?{{rakontu.urlQuery}}">{{template_remove_this_rakontu}}</a>
			</div>
			</fieldset>
			<p>&nbsp;</p>
    	{% endfor %}
    	
		<p><a href="/{{dir_admin}}/{{url_create1}}">{{template_create_another}} Rakontu</a></p>
		<p></p>

		{% if development %}
			<h2><i>{{template_fake_data}}</i></h2>
			<fieldset>
			<p>{{template_add_fake_data}}</p>
			<table cellpadding="4" cellspacing="0">
		   	{% for rakontu in rakontus %}
			    	<tr>
			    	<td>{{rakontu.linkString}} ({{rakontu.getKeyName}})</td>
			    	<td>
						<input type="text" size="4" name="numItems|{{rakontu.key}}" value="10">
						<select name="createWhat|{{rakontu.key}}">
							<option value="members">{{template_members}}</option>
							<option value="entries" selected="selected">{{template_entries}}</option>
							<option value="annotations">{{template_annotations}}</option>
							<option value="answers">{{template_answers}}</option>
							<option value="nudges">{{template_nudges}}</option>
							</select>
						<input type="submit" name="addFakeDataTo|{{rakontu.key}}" value="{{button_add}}" class="button">
						</td>
					</tr>
		    {% endfor %}
		    </table>
			<p><a href="/{{dir_admin}}/{{url_make_fake_data}}">{{template_fake_rakontu}}</a></p>
			 </fieldset>
	    {% endif %}
	    
	   
	    </form>
		</div>
 
    {% else %}
    	<p>&nbsp; &nbsp; {{template_none}} - <a href="/{{dir_admin}}/{{url_create1}}">{{template_create_one}}</a></p>
		{% if development %}
			<p><a href="/{{dir_admin}}/{{url_make_fake_data}}">{{template_fake_rakontu}}</a></p>
		{% endif %}
    {% endif %}	
    
	</div>
	{% include "../common_footer.html" %}
	</body>
</html>
